package com.loriot.common.maximize_sum_of_squares_of_digits_3723;

/**
 * @Title: Main
 * @Package: com.loriot.common.maximize_sum_of_squares_of_digits_3723
 * @Description:
 * @Author: zzy boy
 * @Date: 2025/10/28 10:29
 * @Version: 0.0.1-alpha
 */

public class Main {
    class Solution {
        public String maxSumOfSquares(int num, int sum) {
            StringBuilder rst = new StringBuilder();
            for(int i=0;i<num;i++){
                if(sum>=9){
                    sum-=9;
                    rst.append('9');
                }else{
                    rst.append((char)('0'+sum));
                    sum-=sum;
                }
            }
            if(sum>0)return "";
            return rst.toString();
        }
    }
}
